<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <title>登录后台</title>
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="stylesheet" href="../css/reset.css" media="screen"
          title="no title" charset="utf-8">
    <link rel="stylesheet" href="css/login.css" media="screen" title="no title"
          charset="utf-8">
</head>
<body>
<div class="container">
    <div class="login-box animated fadeInUp">
        <div class="box-header">
            <h2 class="login-title">Log In</h2>
        </div>
        <label for="username">用 户 名</label>
        <br/>
        <input type="text" id="username">
        <br/>
        <label for="password">密 码</label>
        <br/>
        <input type="password" id="password">
        <br/>
        <p class="link_pwd"></p>
        <button id="sub">L O G I N</button>
        <br/>
        <a href="#"><p class="small">Forgot your password?</p></a>
    </div>
</div>
<script type="text/javascript" src="../js/jquery-1.12.4.min.js"></script>
<script>
$(function() {
	$("#sub").click(function() {
		var account = $("#username");
		var password = $("#password");
		if (account.val() == "") {
			account.focus();
			return false;
		}else if (password.val() == "") {
			password.focus();
			return false;
		}

		$.ajax({
			url : "../login.do",
			type : "POST",
			data : {
				"account" : account.val(),
				"password" : password.val(),
			},
			dataType : "json",
			success : function(msg) {
				console.log(msg);
				if (!msg) {
					$(".link_pwd").html("用户名或密码错误");
					setTimeout(function(){$(".link_pwd").html("")},3000);
				} else{
					location.href = '../jump.do';
				}
			},
			error : function(er) {
				console.log(er);
			}
		});

	});
});
</script>	

</body>
</html>



